package com.ssm.service;

import com.ssm.pojo.DetailShoppingCart;
import com.ssm.pojo.Shoppingcart;

import java.util.List;

/**
 * @program: exercise1_online_shopping
 * @author: qin haojun
 * @create: 2021-02-14 16:37
 */
public interface ShoppingcartService {


    /**
     * 通过userId和status选择购物车，两个参数可有可无
     * @param userId  可为null
     * @param status 可为null
     * @return
     * @throws Exception
     */
    public List<Shoppingcart> selectCartByUidStatus(int userId, boolean status)
            throws Exception;

    //加入商品时新增购物车，除了id所有信息不能为空
    public void addShoppingCart(Shoppingcart shoppingCart)throws Exception;

    /**
     * 通过id更新购物车状态，比如当用户购买了这件商品后status从0（未买）变1（已买）
     * @param shoppingcartId
     * @param status
     * @throws Exception
     */
    public void updateStatusById(Integer shoppingcartId, boolean status)throws Exception;

    //当用户从购物车中删除商品时删除数据库，通过id删除
    public void deleteShoppingCartById(Integer shoppingcartId)throws Exception;

    //获得一位用户的详细的购物清单，包括货物种类，价格等
    public List<DetailShoppingCart> selectDetailShoppingCart(Integer userId)throws Exception;
}
